<template>
	<view class="container">
		<view class="navbar">
			<navbar ref="navbar" :config="config"></navbar>
		</view>
		<view class="wallet">
			<!-- <image :src="imgUrl+'/my-top-bgImg.png'"></image> -->
			<div class="bg"></div>
			<view class="position-ab u-FFF">
				<view class=" u-plr30">
						<view class="u-flex-center-sb">
							<view class="u-font30">可使用金额</view>
							<view class="u-font24" @click="goTransactionDetail">交易明细 <text class="iconfont u-ml10">&#xe6c7;</text> </view>
						</view>
						<view class="u-font28 u-mt15"> <text class="">￥</text> <text class="font50">{{dataFrom.balance}}</text> 元 </view>
				</view>
			</view>
			<view v-if="ispay" class="u-flex-center-sb u-mt30 bg-fff" @click="goCardBag">
				<view class="u-font26 u-181818">去购卡</view>
				<view class="iconfont u-999">&#xe6c7;</view>
			</view>
		</view>
	</view> 
</template>

<script>
	let app = getApp()
	export default {
		data() {
			return {
				config: {
					back: true, //false是tolbar页面 是则不写
					title: '我的钱包',
					color: '#ffffff',
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [0, '#ffffff'],
					statusBarFontColor: '#ffffff',
				},
				dataFrom:{},
				imgUrl: this.$mConfig.staticUrl,
				ispay: app.globalData.openPay
			}
		},
		onLoad() {
			//获取用户账户信息
			this.$http.get('/account/getAccountInfo',).then(res => {
				if(res&&res.code==200){
					 this.dataFrom = res.data
				}
				})
		},
		methods:{
			//返回上一页
			getback(){
				uni.redirectTo({
					url:"../../index/my"
				})
			},
			//交易明细
			goTransactionDetail(){
				uni.navigateTo({
					url:"transactionDetail"
				})
			},
			//去购卡
			goCardBag(){
				uni.navigateTo({
					url:"cardBag"
				})
			}
		}
		}
</script>

<style lang="scss">
	page{
		background-color: #F5F5F5;
	}
	.navbar {
			position: absolute;
			top: 0;
			left: 0;
		}
	.wallet{
		position: relative;
		.bg{
			width: 100%;
			height: 402rpx;
			background-color: #0B844A;
		}
		.position-ab{
			position: absolute;
			width: 100%;
			top: 186rpx;
			.top-title {
				height: 50rpx;
				line-height: 50rpx;
			}
			.font50{
				font-size: 50rpx;
			}
		}
		.bg-fff{
			background-color: #FFFFFF;
			padding: 32rpx 30rpx;
		}
	}
</style>
